<?php

namespace App\Transformers\Frontend;

use App\Models\Customer\Follow;
use League\Fractal\TransformerAbstract;

class FollowTransformer extends TransformerAbstract
{

    protected $availableIncludes = ['video'];

    protected $hidden = ['deleted_at'];

    public function transform(Follow $model)
    {
        $model->makeHidden($this->hidden);
        return $model->attributesToArray();
    }

    public function includeVideo(Follow $model)
    {
        $video = $model->video;
        if (!$video) {
            return $this->null();
        }
        return $this->item($video, new VideoTransformer());
    }
}